import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';
import App from './App';
import Login from './views/login';
import Register from './views/register';
import * as serviceWorker from './serviceWorker';
import { Provider } from 'react-redux'
import store from './store'
import Information from './views/user/user-information'
import Cardindex from './views/application/card/cart-inedx'
import Cardchongzhi from './views/application/card/cart-chongzhi'
import Cardczsuccess from './views/application/card/cart-czsuccess'
import Cardczfail from './views/application/card/cart-czfail'
import Equipmentindex from './views/application/equipment'
import Equipmentall from './views/application/equipment/equipmentall'
import Classroomall from './views/application/equipment/classroomall'
import Schoolnotice from './views/application/school_notice/index.jsx'
import Schoolnoticedetail from './views/application/school_notice/notice_detail/index'
import Editschoolnotice from './views/application/school_notice/notice_detail/edit'
import Schoolnews from './views/application/school-news/index'
import Schoolnewsdetail from './views/application/school-news/notice_detail/index'
import Editschoolnews from './views/application/school-news/notice_detail/edit'
import ChatScreen from './views/news/news-chatScreen'
// import ContactsList from './views/news/contactsList'
//课程部分组件
import Signin from './views/curriculum/signin' //课程签到组件
import Readycourse from './views/curriculum/readycourse/index' //课程准备组件
import ContactsList from './views/news/contactsList'
import PersonalProfile from './views/news/profiles/personalProfile'
import GroupProfile from './views/news/profiles/groupProfile'
import ChatSettingsGroup from './views/news/profiles/chatSettingsGroup'
import ChatSettingsPersonal from './views/news/profiles/chatSettingsPersonal'
import StartGroupCHat from './views/news/startGroupCHat'
import StartGroupCHatSetting from './views/news/startGroupCHat/startGroupCHat-setting'
import { HashRouter as Router, Switch, Route } from 'react-router-dom';
//用户全页面组件
import routes from './routes'
import PersonalInformation from './views/user/userSubpage/personal-information/index'//个人信息
import ChangePwd from './views/user/userSubpage/ChangePwd/index'//修改密码
import UserSetting from './views/user/userSubpage/UserSetting/index'//设置
import ChangeName from './views/user/userSubpage/ChangeName/index'//修改名称
import CheckUser from './views/user/userSubpage/CheckUser/index'//用户验证
import NewTel from './views/user/userSubpage/CheckUser/newTel'// 新的手机号
import CheckTel from './views/user/userSubpage/CheckUser/checkTel'// 新的手机号
import MyQr from './views/user/userSubpage/MyQr/index'// 我的二维码
import Feedback from './views/user/userSubpage/Feedback/index'// 反馈
import Resp from './views/user/userSubpage/Resp/index'// 免责声明
import UserAbout from './views/user/userSubpage/UserAbout/index'// 关于

ReactDOM.render(
  <Provider store={store}>
    <Router>
      <Switch>
        {
          // <Route path="/" > <App /> </Route>
        }
        {/* 抽离路由 */}
        {
          routes.map((route, index) => {
            return <Route key={index} path={route.path} component={route.component} />
          })
        }

        {/* 我的页面，不带footer的页面 */}
        <Route path="/user/personal-information" component={PersonalInformation} />
        <Route path="/user/changeName" component={ChangeName} />

        <Route path="/user/changePwd" component={ChangePwd} />
        <Route path="/user/setting" component={UserSetting} />
        <Route path="/user/myqr" component={MyQr} />

        <Route path="/user/CheckUser" component={CheckUser} />
        <Route path="/user/newTel" component={NewTel} />
        <Route path="/user/checkTel" component={CheckTel} />
        <Route path="/user/feedback" component={Feedback} />
        <Route path="/user/resp" component={Resp} />
        <Route path="/user/userabout" component={UserAbout} />
        {/* ******************************************* */}
        <Route path="/login" component= { Login } />
        <Route path="/register" component= { Register } />
        <Route path="/application/card/chongzhi" component= { Cardchongzhi } />
        <Route path="/application/card/czsuccess" component= { Cardczsuccess } />
        <Route path="/application/card/czfail" component= { Cardczfail } />
        <Route path="/application/card/index" component= { Cardindex } />
        <Route path="/application/equipment" component= { Equipmentindex } />
        <Route path="/application/equipmentall" component= { Equipmentall } />
        <Route path="/application/classroomall" component= { Classroomall } />
        <Route path="/application/schoolnotice" component= { Schoolnotice } />
        <Route path="/application/schoolnoticedetail" component= { Schoolnoticedetail } />
        <Route path="/application/editschoolnotice" component= { Editschoolnotice } />
        <Route path="/application/schoolnews" component= { Schoolnews } />
        <Route path="/application/schoolnewsdetail" component= { Schoolnewsdetail } />
        <Route path="/application/Editschoolnews" component= { Editschoolnews } />
        <Route path="/user/information" component= { Information } />

        <Route path="/news-chatScreen/:dataId" component= { ChatScreen } />
        <Route path="/register" component= { Register } />
        <Route path="/login" component={Login} />
        <Route path='/curriculum/today/siginin' component={Signin} />
        <Route path='/curriculum/today/readycourse' component={Readycourse} />
        <Route path="/application/card/chongzhi" component={Cardchongzhi} />
        <Route path="/application/card/czsuccess" component={Cardczsuccess} />
        <Route path="/application/card/index" component={Cardindex} />
        <Route path="/user/information" component={Information} />
        <Route path="/news-chatScreen/:dataId" component={ChatScreen} />
        <Route path="/register" component={Register} />
        <Route path="/" component={App} />
        <Route path="/login" component={Login} />
        <Route path="/application/card/chongzhi" component={Cardchongzhi} />
        <Route path="/application/card/czsuccess" component={Cardczsuccess} />
        <Route path="/application/card/czfail" component={Cardczfail} />
        <Route path="/application/card/index" component={Cardindex} />
        <Route exact path="/user/information" component={Information} />
        <Route path="/news-chatScreen/:dataId" component={ChatScreen} />
        <Route path="/register" component={Register} />
        
        {/* 我的页面全页面路由 */}
        <Route path="/user/personal-information" component={PersonalInformation} />
        <Route path="/user/changePwd" component={ChangePwd} />
        <Route path="/user/setting" component={UserSetting} />
        <Route path="/user/changeName" component={ChangeName} />
        <Route path="/user/CheckUser" component={CheckUser} />
        {/* === */}
        {/* <Route path='/news/contactsList' component={ ContactsList }/> */}
        <Route path='/curriculum/today/siginin' component={Signin} />
        <Route path="/user/information" component={Information} />

        <Route path="/" component={App} />
        <Route path="/news/chatScreen/:dataId" exact component= { ChatScreen } />
        <Route path='/news/contactsList/:level' exact component={ ContactsList }/>
        <Route path='/news/personalProfile/:id' exact component={ PersonalProfile }/>
        <Route path='/news/groupProfile/:id' exact component={ GroupProfile }/>
        <Route path='/news/chatSettingsGroup/:id' exact component={ ChatSettingsGroup }/>
        <Route path='/news/chatSettingsPersonal' exact component={ ChatSettingsPersonal }/>
        <Route path='/news/startGroupCHat' exact component={ StartGroupCHat }/>
        <Route path='/news/startGroupCHat/startGroupCHat-setting' exact component={ StartGroupCHatSetting }/>
        <Route path="/" component= { App } />
      </Switch>
    </Router>
  </Provider>,
  document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
